/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dataDraw.classDiagramDraw;

import data.DataVector;
import data.classDiagram.Entity;
import dataDraw.BackgroundDraw;

import java.awt.Graphics;
import java.util.List;


/**
 * Szymon Kudzia
 * Pattern: Facade
 */
public class ClassDiagramDraw {
	protected EntityDraw entityDraw;
	protected EntityConnectionDraw connectionDraw;
	protected BackgroundDraw backgroundDraw;

    public ClassDiagramDraw() {
    }

	public void drawClassDriagram(List<Entity> entityList, Graphics g, int width, int height) {
		drawBackground(g, width, height);

		for (Entity entity : entityList) {
			drawEntity(entity, g);
		}

		for (Entity entity : entityList) {
			drawConnections(entity, g);
		}
	}

	public void drawBackground(Graphics graphics, int width, int height) {
		backgroundDraw.draw(graphics, width, height);
	}
    public void drawEntity(Entity entity, Graphics graphics) {
	    entityDraw.draw(entity, graphics);
    }

    public void drawConnections(Entity entity, Graphics graphics) {
		connectionDraw.draw(entity, graphics);
    }

	public void setEntityDraw(EntityDraw entityDraw) {
		this.entityDraw = entityDraw;
	}

	public void setConnectionDraw(EntityConnectionDraw connectionDraw) {
		this.connectionDraw = connectionDraw;
	}

	public void setBackgroundDraw(BackgroundDraw backgroundDraw) {
		this.backgroundDraw = backgroundDraw;
	}
}
